<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台</title>
<link href="../template/css/ke.css" rel="stylesheet" type="text/css" />
<script src="http://img.kekenet.com/statics/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/uploadify/jquery.uploadify-3.1.min.js"></script>
<link href="../static/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- main -->
<div>
<script type="text/javascript" src="http://img.kekenet.com/cms/editor1/editor_config.js"></script>
<script type="text/javascript" src="http://img.kekenet.com/cms/editor1/editor_all.js"></script>
<script type="text/javascript" src="http://img.kekenet.com/cms/editor1/qhformat.js"></script>
<script type="text/javascript" src="http://img.kekenet.com/cms/editor1/qqshot.js"></script>
<link rel="stylesheet" href="http://img.kekenet.com/cms/editor1/ueditor.css"/>

<div id="qqhost_box" style="position: absolute;z-index:999999; background-color: #fff; border: 1px solid #666; width: 600px; height: 200px;display:none;">
	<iframe id="hidden_iframe" name="hidden_iframe" onload="qq_shot_uploaded();" style="display: none;"></iframe>
	<div id="qqshot_frm"></div>
	<button onclick="qq_shot_close();">关闭</button>
</div>

<div class="issCont">
  <form id="frm_box" name="frm_box" method="POST" enctype="multipart/form-data" onsubmit="return check_sub();">
  <div class="ic_TabNav">
    <ul>
      <li class="ic_TabNav_tab"><a href="#" class="tab_font">{{if $id != 0}}编辑文章{{else}}发布文章{{/if}}</a><a href="#" class="tab_close"></a></li>
    </ul>
  </div>
  
  <div class="ic_TabBox">
    <table border="0" cellspacing="3" cellpadding="2">
      <tr>
        <td width="65" class="align-right"><span>*</span>栏目：</td>
        <td width="473">
		  <select name="catid" onchange="check_catid_selected(this);">
		  <option value="0" selected="selected">请选择</option>
		  {{foreach from=$sub_cats item=c1}}
		    <option value="{{$c1['catid']}}" {{if !is_array($c1['child']) || empty($c1['child']) }}data-cans="1"{{/if}} {{if $catid == $c1['catid']}}selected="selected"{{/if}} >{{$c1['catname']}}</option>
            {{foreach from=$c1['child'] item=c2}}
			  <option value="{{$c2['catid']}}" {{if !is_array($c2['child']) || empty($c2['child']) }}data-cans="1"{{/if}} {{if $catid == $c2['catid']}}selected="selected"{{/if}}>->{{$c2['catname']}}</option>
              {{foreach from=$c2['child'] item=c3}}
			    <option value="{{$c3['catid']}}" {{if !is_array($c3['child']) || empty($c3['child']) }}data-cans="1"{{/if}} {{if $catid == $c3['catid']}}selected="selected"{{/if}}>--->{{$c3['catname']}}</option>
		      {{/foreach}}
            {{/foreach}}
		  {{/foreach}}
		  </select>
		  <span id="err_catid_selected" style="display:none;">此栏目不能添加文章</span>
	    </td>
      </tr>
      <tr>
        <td class="align-right"><span>*</span>标题：</td>
        <td><input name="title" id="title" value="{{$title|default:''}}" onblur="qscws(this);" type="text" class="sendbox_title" /></td>
      </tr>
      <tr>
        <td class="align-right"><span>*</span>来源：</td>
        <td>
		  <input name="copyurl" id="copyurl" value="{{$copyfrom_href|default:''}}" type="text" class="sendbox_source" />
		  <input name="copyname" id="copyname" value="{{$copyfrom_text|default:''}}" type="text" class="sendbox_source" />
		  <select name="copyfrom" id="copyfrom" class="sendbox_source_select">
		    <option value="" selected="selected">≡请选择≡</option>
            {{foreach from=$cf_list item=cf}}
		    <option value="{{$cf['id']}}" {{if $copyfrom == "|{{$cf['id']}}"}}selected="selected"{{/if}}>{{$cf['sitename']}}</option>
            {{/foreach}}
		  </select>
		</td>
      </tr>
      <tr>
        <td valign="top" class="align-right">音频：</td>
        <td>
        	<input type="text" name="file_url" value="{{$fileurl|default:''}}" class="sendbox_audio" />
        	<div id="file_upload_mp3" class="uploadify" style="height: 30px; width: 120px; "></div>
          <!-- <input type="text" name="file_url" value="{{$file_url|default:''}}" class="sendbox_audio" /> -->
        </td>
      </tr>
      <tr>
        <td valign="top" class="align-right">字幕：</td>
        <td>
        	<div id="file_upload_lrc" class="uploadify" style="height: 30px; width: 120px; "></div>
          <!-- <input type="text" name="file_url" value="{{$file_url|default:''}}" class="sendbox_audio" /> -->
        </td>
      </tr>
      <tr>
        <td class="align-right"><span>*</span>作者：</td>
        <td><input name="author" id="author" value="{{$now_name}}" type="text" class="sendbox" /></td>
      </tr>
      <tr>
        <td class="align-right">缩略图：</td>
        <td><input type="file" name="thumb" class="ic_TabBox_botton" /><em>支持jpg、jpeg、gif、png、bmp格式</em></td>
      </tr>
      <tr>
        <td class="align-right"><span>*</span>关键字：</td>
        <td><input name="keywords" id="keywords" value="{{$keywords|default:''}}" type="text" class="sendbox" /><em>多关键词之间用空格或者“,”隔开</em></td>
      </tr>
      <tr>
        <td valign="top" class="align-right"><span>*</span>摘要：</td>
        <td>
          <textarea name="description" class="send">{{$description|default:''}}</textarea>
          <!-- <br />
          <em>还可以输入225个字符</em> -->
		</td>
      </tr>
    </table>
      
    <!--opations-->
    <table width="100%" border="0" cellspacing="1" cellpadding="0" class="TabOption">
      <tr>
        <td>
        	<select name="paginationtype" id="paginationtype">
				    <option value="0" {{if $paginationtype == "0"}}selected="selected"{{/if}}>不分页</option>
						<option value="1" {{if $paginationtype == "1"}}selected="selected"{{/if}}>自动分页</option>
				    <option value="2" {{if $paginationtype == "2"}}selected="selected"{{/if}}>手动分页</option>
				  </select>
        </td>
        <td><input name="posids" type="checkbox" value="1" {{if $posids == "1"}}checked="checked"{{/if}} />头条推荐</td>
        <td>
          <input name="attribute[]" type="checkbox" value="1" {{if isset($attribute[1]) && $attribute[1] == "1"}}checked="checked"{{/if}}  /><img src="../template/images/icon_nature_1.gif" width="16" height="16" />
          <input name="attribute[]" type="checkbox" value="2" {{if isset($attribute[2]) && $attribute[2] == "1"}}checked="checked"{{/if}} /><img src="../template/images/icon_nature_2.gif" width="16" height="16" />
          <input name="attribute[]" type="checkbox" value="3" {{if isset($attribute[3]) && $attribute[3] == "1"}}checked="checked"{{/if}} /><img src="../template/images/icon_nature_3.gif" width="16" height="16" />
          <input name="attribute[]" type="checkbox" value="4" {{if isset($attribute[4]) && $attribute[4] == "1"}}checked="checked"{{/if}} /><img src="../template/images/icon_nature_4.gif" width="16" height="16" />
          <input name="attribute[]" type="checkbox" value="5" {{if isset($attribute[5]) && $attribute[5] == "1"}}checked="checked"{{/if}} /><img src="../template/images/icon_nature_5.gif" width="16" height="16">
         </td>
         <td>中英对照：
          <input name="isnot" type="radio" value="1" {{if $isnot == "1"}}checked="checked"{{/if}}/>是
          <input name="isnot" type="radio" value="0" {{if $isnot == "0"}}checked="checked"{{/if}}/>不是
          <input name="isnot" type="radio" value="2" {{if $isnot == "2"}}checked="checked"{{/if}}/>左右
        </td>
      </tr>
    </table>
    <!--/opations-->
    
    <div class="plug-in">
      <textarea name="content" id="content" style="width:782px;" >{{$content|default:''}}</textarea>
		</div>
    
    <!-- <div class="CutOut">
	  <input name="" type="checkbox" value="" /> 是否截取内容 
	  <input name="" type="text" class="cut_sendbox" /> 字符至内容摘要 
	  <input name="" type="checkbox" value="" />是否获取内容第 
	  <input name="" type="text" class="cut_sendbox" /> 张图片作为标题图片
	</div> -->
    <table border="0" cellspacing="5" cellpadding="0">
      <tr>
        <td>
        	<input name="islink" type="checkbox" value="1" {{if $islink == "1"}}checked="checked"{{/if}}/> 转向外链：
        	<input name="linkurl" type="text" class="sendbox" value="{{if $islink == "1"}}{{$url}}{{/if}}"/>
        </td>
        <td>内容页模板：<select name="template"><option value="">show.html</option></select></td>
        <td>发布时间：
		  <link rel="stylesheet" type="text/css" href="../template/calendar/jscal2.css"/>
		  <link rel="stylesheet" type="text/css" href="../template/calendar/border-radius.css"/>
		  <link rel="stylesheet" type="text/css" href="../template/calendar/win2k.css"/>
		  <script type="text/javascript" src="../template/calendar/calendar.js"></script>
		  <script type="text/javascript" src="../template/calendar/lang/en.js"></script>
		  <input type="text" name="inputtime" id="inputtime" value="{{$now_time}}" size="21" readonly class="date" />
		  <script type="text/javascript">
			Calendar.setup({
			weekNumbers: true,
		    inputField : "inputtime",
		    trigger    : "inputtime",
		    dateFormat: "%Y-%m-%d %H:%M:%S",
		    showTime: 12,
		    minuteStep: 1,
		    onSelect   : function() {this.hide();}
			});
          </script>
		  <!-- <input name="inputtime" value="{{$now_time}}" type="text" class="sendbox" /> -->
		</td>
      </tr>
    </table>
    
    <table border="0" cellspacing="5" cellpadding="0">
      <tr>
        <td valign="top">添加习题：</td>
		<td>
		  <textarea name="kkq_q" class="send_plus">{{$question|default:''}}</textarea>
		</td>
        <td valign="top">添加答案：</td>
		<td>
		  <textarea name="kkq_a" class="send_plus">{{$answer|default:''}}</textarea>
		</td>
      </tr>
    </table>
    
    <div class="ending">
	  <input type="hidden" name="id" value="{{$id|default:'0'}}" />
	  <input type="hidden" name="url" value="{{$url|default:''}}" />
	  {{if $id != 0}}
      <input value="" type="submit" class="UP" />
      <input type="submit" value="" id="do_new" class="SAVE" />
	  <script>
      $('#do_new').click(function(){
    	  // location.href='detail.add?pid={{$pid}}&id={{$id|default:'0'}}';
	  		$('#frm_box').attr('action', 'detail.add?pid={{$pid}}');
      });
      </script>
	  {{else}}
	  <input value="" type="submit" class="ISS" />
	  {{/if}}
    </div>
  </div>
  </form>
</div>
<script type="text/javascript">

$(function() {
  var mp3_ot = '';
  $("#file_upload_mp3").uploadify({
    height    : 30,
    swf       : '../static/uploadify/uploadify.swf',
    uploader    : '../static/uploadify/upload_mp3.php',
    width     : 120,
    multi : false,
    'fileTypeDesc' : 'mp3 Files',
    'fileTypeExts' : '*.mp3',
    onUploadComplete : function(file) {
      if(mp3_ot=='1') {
        $('#file_upload_mp3').html('<span style="color: red;">已上传成功</span> ' + file.name);
      } else {
        $('#file_upload_mp3-queue').html('<span style="color: red;">' + mp3_ot + '</span>');
      }
    },
    onUploadSuccess : function(file,a) {
      mp3_ot = a;
    }
  });
  var lrc_ot = '';
  $("#file_upload_lrc").uploadify({
    height         : 30,
    swf            : '../static/uploadify/uploadify.swf',
    uploader       : '../static/uploadify/upload_lrc.php',
    width          : 120,
    multi          : false,
    'fileTypeDesc' : 'lrc Files',
    'fileTypeExts' : '*.lrc',
    onUploadComplete: function(file){
      if(lrc_ot=='1') {
        $('#file_upload_lrc').html('<span style="color: red;">已上传成功</span> ' + file.name);
      } else {
        $('#file_upload_lrc-queue').html('<span style="color: red;">' + lrc_ot + '</span>');
      }
    },
    onUploadSuccess : function(file,a) {
      lrc_ot = a;
    }
  });
});

var editor = new baidu.editor.ui.Editor();
editor.render("content");

var qscws = function(dom) {
	$.getJSON('home.scws', {
		str: $(dom).val()
	}, function(d){
		$('#keywords').val(d.strs.join(' '));
	});
}

var check_catid_selected = function(s) {
	if($(s).find('option:selected').attr('data-cans') !== undefined) {
		$('#err_catid_selected').hide();
	} else {
		$('#err_catid_selected').show();
	}
}

//检测提交的数据
function check_sub(){
	
	var title = $('#title').val();
	if(!title.length>0){
		alert('标题不能为空');
		$('#title').focus();
		return false;
	}

	if($('select[name=catid]').find('option:selected').attr('data-cans') == undefined) {
		alert('此栏目不能添加文章');
		return false;
	}
	
	if($('select[name=catid]').val() == 0) {
		alert('必须选择所属栏目');
		return false;
	}
	
	var copyurl = $('#copyurl').val();
	var copyname = $('#copyname').val();
	var copyfrom_data = $('#copyfrom').val();
	if(copyurl=='网址'){
		copyurl = '';
	}
	if(copyname=='网站名称'){
		copyname = '';
	}
	if(copyurl=='' && copyname=='' && copyfrom_data==0){
		alert('请输入来源');
		$('#copyurl').focus();
		return false;
	} else if(copyurl=='' && copyfrom_data==0){
		alert('请输入来源');
		$('#copyurl').focus();
		return false;
	} else if(copyname=='' && copyfrom_data==0){
		alert('请输入来源');
		$('#copyname').focus();
		return false;
	}

	var author = $('#author').val();
	if(!author.length>0){
		alert('作者不能为空');
		$('#author').focus();
		return false;
	}

	var keywords = $('#keywords').val();
	if(!keywords.length>0){
		alert('关键字不能为空');
		$('#keywords').focus();
		return false;
	}
	
	var content = editor.hasContents();
	if(!content){
		alert('内容不能为空');
		editor.focus();
		return false;
	}
	
	// console.log(editor);
	// return false;
}
</script>
</div>
<!-- /main -->
</body>
</html>